package com.ts.base.config;




import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

@Getter
@Setter
public  class  APIResult<T> implements Serializable {

    private static final long serialVersionUID=4747774542107711845L;

    private String code;

    private String msg;

    private T result;




    public static<T> APIResult success(T result){
        APIResult apiResult=new APIResult();
        apiResult.setResult(result);
        apiResult.setCode("000000");
        apiResult.setMsg("success");
        return  apiResult;
    }

    public static<T> APIResult error(String code,String msg){
        APIResult apiResult=new APIResult();
        apiResult.setCode(code);
        apiResult.setMsg(msg);
        return  apiResult;
    }

//    public static<T> APIResult error(RetCodeEnum codeEnum){
//        APIResult apiResult=new APIResult();
//        apiResult.setCode(codeEnum.getCode());
//        apiResult.setMsg(codeEnum.getMsg());
//        return  apiResult;
//    }


}
